package com.jy.entity;

public  class R<T>{
    private int code = 200;//返回状态码
    private String msg="success";//返回响应消息
    private T data;//数据

    public static R result(){
        return new R();
    }

    public static R result(int code,String msg){
        R r = new R();
        r.setCode(code);
        r.setMsg(msg);
        return r;
    }

    public static <T> R result(T data){
        R r = new R();
        r.setData(data);
        return r;
    }

    public static <T> R result(int code,String msg,T data){
        R r = new R();
        r.setCode(code);
        r.setMsg(msg);
        r.setData(data);
        return r;
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
